﻿using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Linq;
using WYJCore.Extension;
using WYJCore.Web;
using WYJWeb.Models;

namespace WYJWeb.Apis
{
    public class RoleController : ControllerBase<Role>
    {
        public override string BaseWhere(string key)
        {
            return "Name".Like(key);
        }

        public Response GetMenus(string form)
        {
            return Respond(db =>
            {
                var list = JsonConvert.DeserializeObject<List<int>>(form);

                return list.Select(i => ConsoleCenter.Menus.Find(m => m.NodeId == i));
            });
        }


    }
}
